<template>
	<view style="background-color: #F4F5F7;height: 100vh;">
		<!-- 导航栏 -->
		<view>
			<uni-nav-bar title="审核列表" :border="false" left-icon="left" @clickLeft="back" :fixed="true"
				background-color="#FFFFFF;" :statusBar="true">
			</uni-nav-bar>
		</view>
		<view style="position: relative; background-color: #F4F5F7;">
			<view class="scroll-view-item" v-for="(taskListItem,taskListIndex) in taskList" :key="taskListIndex" style="transform: scale(0.9); height:380rpx;
				background-color:#FFFFFF;border-radius: 10px;">
				<!-- 订单号 -->
				<view style="display: flex; justify-content:space-between;">
					<view style="margin-top: 15px;margin-left: 15px;">{{taskListItem.taskRecord.order_id}}</view>
					<view style="margin-top: 15px;margin-right: 15px;display: flex;justify-content: space-around;">
						<text>支付方式:&nbsp;</text>
						<up-image :show-loading="true" src="/static/Alipay.png" width="20px" height="20px"
							@click="click" style="margin-right: 5px;"></up-image>
						<up-image :show-loading="true" src="/static/wechat.png" width="22px" height="20px"
							@click="click"></up-image>
					</view>
				</view>
				<u-line :hairline="false" style="margin-top: 20px;transform: scale(0.95);"></u-line>
				<!-- 任务标题 -->
				<view style="display: flex; justify-content:space-between;">
					<view style="margin-top: 15px;margin-left: 15px;">
						<text style="">{{taskListItem.taskRecord.title}}</text>
					</view>
					<view style="margin-top: 15px;margin-right: 15px;">
						<text
							style="font-size: 28px; font-weight:800;">{{taskListItem.taskRecord.money}}</text>&nbsp;&nbsp;&nbsp;呜噜币
					</view>
				</view>
				<!--任务时间 和任务奖励-->
				<view style="display: flex; justify-content:space-between;">
					<view style="margin-top: ;margin-left: 15px;">
						<text style="font-size: 12px;font-weight:400;">
							{{taskListItem.taskRecord.data_statr}}
						</text>
					</view>
					<view style="margin-top: ;margin-right: 15px;">
						<text style="font-size: 12px;">
							任务奖励
						</text>
					</view>
				</view>
				<!-- 领取 -->
				<view style="display: flex;justify-content: space-between;">
					<!-- 发布人 -->
					<view style="margin-top: 15px;margin-left: 15px;">
						<up-avatar :src="taskListItem.user.avatar" size="40"
							style="box-shadow: 0 0 0 3px white;"></up-avatar>
					</view>
					<view style="margin-top: 20px;margin-right: 15px;">
						<u-button text="" color="#FE4D53" style="width:120px;height: 30px;"
							@click="pullTask(taskListItem.id,taskListItem.work_id)" :disabled="disabled" shape="circle"
							size="mini"><text style="font-weight: 400;font-size:14px;">{{btnTitle}}</text></u-button>
					</view>
				</view>
			</view>
			<view v-if="btnHidden"
				style="position: relative;top: 300px;display: flex;align-items: center;justify-content: center;">
				<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" :show="noList">
				</u-empty>
			</view>
			<!-- </scroll-view> -->
		</view>
	</view>
</template>

<script>
	import {
		getVerifyList
	} from "../../request/API/getVerifyList.js";
	export default {
		data() {
			return {
				value2: 1,
				noList: true,
				btnTitle: "去审核",
				btnHidden: true,
				disabled: false,
				taskList: []
			}
		},
		onShow() {
			// const status = 1;
			getVerifyList()
				.then(data => {
					// console.log(data.data.length)
					if (data.data.length == 0) {
						// console.log(123123)
						this.btnHidden = true
					}
					// this.btnHidden = false
					this.taskList = data.data
				})
				.catch(Error => {

				})
		},
		methods: {
			pullTask(e, id) {
				console.log(e, id)
				uni.navigateTo({
					url: "/pages/task/descPending?order_id=" + e + "&id=" + id
				})
			},
			tabClick(index) {
				console.log(index.index)
				const status = index.index + 1;
				taskList({
						status
					})
					.then(data => {
						// console.log(data.data)	
						if (status == 3) {
							console.log(33333333)
							this.disabled = true
							this.btnTitle = "已完成"
						} else if (status == 2) {
							console.log(123123)
							this.disabled = true
							this.btnTitle = "待审核"
						} else if (status == 1) {
							this.disabled = false
							this.btnTitle = "去完成"
						}
						this.taskList = data.data
					})
					.catch(Error => {

					})
			},
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
		},
	}
</script>

<style>
	.scroll-Y {
		height: 1500rpx;
		/* margin-top: 44px; */
	}
</style>